<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCommentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->increments('id');
            $table->string('model')->comment('模型id');
            $table->integer('target_id')->comment('目标id');
            $table->string('avatar')->comment('图像')->nullable();
            $table->string('nickname')->comment('昵称')->nullable();
            $table->string('content')->comment('内容')->nullable();
            $table->tinyInteger('recommended')->default(0)->comment('推荐指数')->nullable();
            $table->integer('zan')->default(0)->comment('点赞数')->nullable();
            $table->string('piclist')->comment('图片列表')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('comments');
    }
}
